#coding=utf-8
import os
from selenium import webdriver
import time

dir = os.path.dirname(os.path.abspath('.'))
chrome_driver_path = dir + '/tools/chromedriver.exe'
driver = webdriver.Firefox()
driver.get('http://main.zgjiaoyan.com/passport/login/?nexturl=http://www.zgjiaoyan.com/')
time.sleep(2)
driver.find_element_by_xpath("//*[@id='loginform']/div/div/div/p/input[2]").click()
time.sleep(1)
print driver.switch_to_alert().text
if u'请输入用户名！'==driver.switch_to_alert().text:
    print('alert correct')
driver.switch_to_alert().accept()